Part Number Hot Search : 
C3216X5 NJU6391 MOC3051 BU2615 144EU SIA418DJ CABLE D1216AAS
Product Description
Full Text Search
 

To Download AN897 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 AN897
Thermistor Temperature Sensing with MCP6SX2 PGAs
Author: Kumen Blake and Steven Bible Microchip Technology Inc. Key specifications include [1, 2]: * Resistance at +25C: 10 k 1% * B25/85 tolerance: 0.75% * Operating temperature range: -40C to +125C (to +150C for short periods) * Maximum power - 100 mW, TTH = 0C to +55C - 100% de-rated at TTH = -40C and +85C * Thermal dissipation factor: 2.2 mW/C * Response time: 1.7 s (in oil)
2.0 1.8 1.6 1.4 1.2 1.0 0.8 0.6 0.4 0.2 0.0
INTRODUCTION
This application note shows two designs that use a precise, negative temperature coefficient (NTC) thermistor for temperature measurement. The thermistor is placed in a resistive divider to linearize the temperature-to-voltage conversion. The voltage is processed in the analog domain by the MCP6SX2 (MCP6S22 or MCP6S92) Programmable Gain Amplifier (PGA) before conversion to the digital domain. The first design is simpler and has a smaller temperature range. The second design changes the PGA's gain to achieve a greater temperature range. Both designs use a piece-wise linear interpolation table to correct the remaining non-linearity and convert voltage into degrees Celsius. The design trade-offs between these approaches will be discussed. These circuits take advantage of the MCP6SX2's input multiplexer (MUX). The PGA is used to process multiple signals and/or temperatures and digitally sets the most appropriate gain for each input. This reduces overall design complexity and allows for temperature correction of other sensors.
Thermistor Error Magnitude (C)
BC Components(R) # 2322 640 55103 10 k @ +25C
-50
-25
0
25
50
75
100 125 150
Thermistor Temperature (C)
FIGURE 2:
Thermistor Accuracy.
THERMISTOR
The thermistor used in the application note is part number 2322 640 55103 from BC Components(R); see Figure 1 and Figure 2. This part is selected for its accuracy and cost. The thermistor's temperature is TTH, while the rest of the circuit is at ambient temperature TA.
1M Thermistor Resistance ()
1000000
Thermistors with different price and accuracy trade-offs may also be used in this application. It is simple to modify the circuits to match the desired accuracy.
CIRCUIT
The circuit shown in Figure 3 is used for both designs described later. It is implemented on the Thermistor PGA PICtailTM Daughter Board (see Appendix A.1 "Thermistor PGA PICtail Daughter Board"). The resistor RA makes the voltage vs. temperature response reasonably linear. RB and CB reduce the noise and act as an anti-aliasing filter for the ADC. The MCP6SX2 PGA (MCP6S22 [5] or MCP6S92 [6]) buffers the voltage VDIV. The PGA can be digitally controlled to change its gain or channel (input). The PIC16F684 [8] is on the Signal Analysis PICtailTM Daughter Board (see Appendix A.2.5 "Signal Analysis PICtail Daughter Board"). It has an internal 10-bit ADC that converts VOUT to the digital domain. It can further process VOUT (e.g., averaging) and convert it to temperature. It communicates with the PGA via the SPITM serial bus.
100k
100000
BC Components(R) # 2322 640 55103 10 k @ +25C
10k
10000
1k
1000
100
100
-50
-25
0
25
50
75
100
125
150
Thermistor Temperature (C)
FIGURE 1:
Thermistor Response.
2004 Microchip Technology Inc.
DS00897B-page 1
AN897
VDD = 5.0V RA 1% RTH 10 k RB 100 k CB 1 F MCP6SX2 PGA CH0 CH1 VREF VOUT 10-bit ADC VREF Firmware VDD VDD PIC16F684
VDIV
VIN
3 Other Input SPITM Bus
FIGURE 3:
Thermistor PGA Circuit.
The thermistor power dissipation causes a self-heating temperature error. Calculating the thermistor's power dissipation across temperature, and then dividing by the specified 2.2 mW/C thermal dissipation factor, gives the self-heating temperature error shown in Figure 5. This is a small, consistent error. It is simple to adjust for this error using the piece-wise linear interpolation table in firmware.
0.30 Self-heating Error (C) 0.25 0.20 0.15 0.10 0.05 0.00 -50 -25 0 25 50 75 100 125 150 Thermistor Temperature (C)
The ADC's voltage reference is powered from the same voltage as the voltage divider, giving a ratiometric circuit; errors in VDD will be automatically corrected at the ADC.
FIRST DESIGN
This design emphasizes simplicity and uses a standard approach to designing the thermistor circuit. The traditional op amp is replaced with a PGA so that it can multiplex multiple inputs.
Analog Design
The first design keeps the PGA at a gain of +1 V/V for design simplicity. The resistor RA is set to its nominal +25C value (10.0 k) for best performance at room temperature; this is a very common design choice. While this is a simpler design, its accuracy is relatively low, as will be seen. Notice that Figure 4 shows a much more linear response than Figure 1.
5.0 4.5 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 -50 -25 0 25 50 75
Design # 1 G = +1 RA = 10 k
VDIV = VOUT (V)
Design # 1 G = +1 RA = 10 k
FIGURE 5: Error.
Thermistor Self-heating
Analog Error Analysis
Figure 6 displays the ADC's temperature resolution, while Figure 7 shows the expected worst-case analog circuit errors. Both plots are based on these assumptions:
100
125
150
Thermistor Temperature (C)
FIGURE 4: Outputs.
Voltage Divider and PGA
* ADC's DC Error 3.5 LSb * PGA's gain error 0.1% (G = +1) * PGA's input offset error 1 mV (including PSRR and temperature drift) * Specified thermistor accuracy This design achieves an ADC temperature resolution of 0.25C over the -25C to +73C temperature range. The analog circuit accuracy is better than 1.2C over the same range. Other temperature ranges will have different resolutions and accuracies.
Temperatures between +125C and +150C can be included in the design for overtemperature indication where accuracy is not as important.
DS00897B-page 2
2004 Microchip Technology Inc.
AN897
0.0
ADC Temperature Resolution (C/LSb)
-0.5 -1.0 -1.5 -2.0 -2.5 -50
10-bit ADC DC Error 3.5 LSb
fixed decimal point degrees Celsius value. The fixed decimal point format reports degrees Celsius in tenths of a degree. Performing the piece-wise linear interpolation in tenths of a degree provides better resolution of degrees Celsius. Finally, the 16-bit degrees Celsius value is sent to the Signal Analysis PC Program for display on the real-time strip chart graph. In the final design, the designer can elect to report in tenths of a degree or round up in whole degrees.
Design # 1 G = +1 RA = 10 k -25 0 25 50 75 100 125 150
Thermistor Temperature (C)
Start Get Real Time Sample
FIGURE 6: Resolution.
10 9 8 7 6 5 4 3 2 1 0
ADC's Temperature
Read ADC
Analog Circuit Errors Magnitude (C)
Design # 1 G = +1 RA = 10 k
Perform PwLI
Send Temperature in C to Strip Chart
ADC Error RA Error PGA Error
End
FIGURE 8:
-50 -25 0 25 50 75 100 125 150 Thermistor Temperature (C)
Flowchart for First Design.
PIECE-WISE LINEAR INTERPOLATION TABLE
A piece-wise linear interpolation table [9] is used to convert ADC codes to estimated temperature. The ADC's codes were divided into 64 segments, with 16 codes per segment. The codes in the table are at end points between segments. Table 1 shows the end points chosen for this design.
FIGURE 7:
Analog Circuit Errors.
Digital Design
The PIC16F684 microcontroller (discussed in Appendix A.2.5 "Signal Analysis PICtail Daughter Board") handles several important tasks. It communicates with the PGA to set its input channel, can average the measured signal to reduce noise and converts the result into the temperature at the thermistor using a piece-wise linear interpolation table. The microcontroller can either have a SPITM port built in or the SPI interface can be implemented in software on the microcontroller [7].
TABLE 1:
Gain (V/V) 1
INTERPOLATION TABLE END POINTS.
ADC Code (LSb) 1008 16 TTH (C) -49.4 156.1 RTH () 630 k 159 VOUT (V) 4.922 0.078
FLOWCHART
The flowchart in Figure 8 shows the program flow for the first design. The firmware is available in 00897.zip file in the Design 1 directory. The firmware was written in relocatable assembly code. main.asm controls the overall program flow. The PGA routines are in pga.inc and pga.asm. The thermistor routines are located in Therm_PGA1.inc and Therm_PGA1.asm. The Signal Analysis PC Program commands the PIC16F684 firmware to perform a real-time sample. The firmware reads the ADC value and passes it to the Piece-wise Linear Interpolation (PwLI) routine. The PwLI routine converts the 10-bit ADC value into a 16-bit
Values given for RTH, when the temperature is outside the thermistor's specified range (-40C to +150C), are estimates only; they are not supported by actual data. The thermistor self-heating error correction has been included in Table 1. The table's entries go outside of the -40C to +150C range to ensure proper functioning of the piece-wise linear interpolation table when the reading overflows. In this algorithm (Appendix A.2.6 "Firmware for the Signal Analysis PICtail Daughter Board"), the table values outside the valid range take on the nearest valid value. This means that when ADC code > 1008, the table returns a value of -49.3C. When ADC code < 16, the table returns a value of 156.1C.
2004 Microchip Technology Inc.
DS00897B-page 3
AN897
Digital Error Analysis
Figure 9 shows the estimated interpolation error for the interpolation table. This design suffers from poor ADC resolution at temperature extremes. The accuracy of this piece-wise linear interpolation table is 0.05C over the -25C to +73C temperature range. Over the -40C to +150C temperature range, the accuracy degrades to 1.0C.
1.0 0.8 0.6 0.4 0.2 0.0 -0.2 -0.4 -0.6 -0.8 -1.0 5.0 4.5 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 -50 -25 Design # 2 RA = 28.0 k
Design # 1
VDIV (V)
Interpolation Error (C)
0 25 50 75 100 125 Thermistor Temperature (C)
150
FIGURE 10:
Voltage Divider Output.
Temperatures between +125C and +150C can be included in the design for overtemperature indication when accuracy is not as important. The thermistor power dissipation causes a self-heating temperature error. Calculating the thermistor's power dissipation across temperature, and then dividing by the specified 2.2 mW/C thermal dissipation factor, gives the self-heating temperature error shown in Figure 11. This is a small, consistent error. It is simple to adjust for this error using the piece-wise linear interpolation table in firmware.
0.12 Self-heating Error (C) 0.10 0.08 0.06 0.04 0.02 0.00 -50 -25 0 25 50 75 100 125 150 Thermistor Temperature (C)
-50
-25
0
25
50
75
100
125
150
Thermistor Temperature (C)
FIGURE 9: Piece-wise Linear Interpolation Error, Design # 1.
The digital roundoff error will be roughly proportional to the ADC temperature resolution curve's envelope (see Figure 6). If the roundoff error is much less than the ADC resolution, this error will have little impact. The total digital error includes both the piece-wise linear interpolation error and the round-off error.
Design # 2 RA = 28.0 k
SECOND DESIGN
This design emphasizes accuracy and resolution. It uses the PGA's capability to change gain to overcome the limitations of the first design. The PGA can multiplex multiple inputs if needed.
Analog Design
The second design changes the PGA's gain from +1 to +8 to +32 V/V. The resistor RA is set to 28.0 k so that the voltage vs. temperature response is reasonably linear at low temperatures; see Figure 10 (compare to Figure 4). The response is nearly flat at higher temperatures, so the PGA's gain will be increased to compensate. Though this is a more complex design, its resolution and accuracy are greater than the first design's.
FIGURE 11: Error.
Thermistor Self-heating
PGA Gain
The sensitivity that VDIV shows to temperature (Figure 10) is poor at higher temperatures. It is intentionally designed this way so that the PGA can be set at higher gains as temperature increases (Figure 12).
DS00897B-page 4
2004 Microchip Technology Inc.
AN897
Analog Error Analysis
5.0 4.5 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 G = +1 G = +8 G = +32
Design # 2 RA = 28.0 k -50 -25
Hysteresis 150
Figure 13 displays the ADC's temperature resolution and Figure 14 shows the expected worst-case analog circuit errors. Both plots are based on these assumptions: * ADC's DC Error 3.5 LSb * PGA's gain error 1% (0.1% at G = +1) * PGA's input offset error 1 mV (including PSRR and temperature drift) * Specified thermistor accuracy This design achieves an ADC temperature resolution of 0.27C over the -40C to +150C temperature range. The analog circuit accuracy is better than 3.0C over the same range. Other temperature ranges will have different resolutions and accuracies.
0.00
ADC Temperature Resolution (C/LSb)
VOUT (V)
0 25 50 75 100 125 Thermistor Temperature (C)
FIGURE 12:
PGA Output Voltage.
The gain change points were chosen to make the ADC's resolution as good as possible (see Figure 13) at a reasonable cost. The number of gains was kept low to minimize the piece-wise linear interpolation table's size in firmware. The maximum voltage allowed in each range is 300 mV from VDD. This keeps the PGA in its specified output range and allows some headroom for noise. The minimum voltage allowed is well above 300 mV from ground, which keeps the PGA in its most linear region of operation. Random noise can make the PGA's gain change frequently. Adding hysteresis to the gain-selection algorithm (in firmware) reduces this problem. The hysteresis needs to be large enough to compensate for the PGA's maximum gain error (1%). Figure 12 and Table 2 show a hysteresis of 1.7C and 2.0C at the lower temperature and higher temperature transistions, respectively. The gain-change points are separated by 6% of VDIV, which is six times larger than the PGA's maximum gain error; this ensures proper functioning of the gain-change algorithm. The thermistor self-heating error has been corrected in Table 2.
-0.05 -0.10 -0.15 -0.20 -0.25 -0.30
Design # 2 RA = 28.0 k
10-bit ADC DC Error 3.5 LSb -50 -25 0 25 50 75 100 125 150
Thermistor Temperature (C)
FIGURE 13: Resolution.
2.0 1.8 1.6 1.4 1.2 1.0 0.8 0.6 0.4 0.2 0.0
ADC's Temperature
Analog Circuit Error Magnitude (C)
Design # 2 RA = 28.0 k PGA Error ADC Error RA Error
TABLE 2:
PGA GAIN-CHANGE POINTS WITH HYSTERESIS.
ADC Code (LSb) < 113 > 960 < 226 > 960 VDIV (V) 0.552 0.586 0.138 0.146 TTH (C) 50.9 49.2 94.6 92.6
Gain (V/V) 1 8 32
Gain Change (V/V) 18 81 8 32 32 8
-50
-25
0
25
50
75
100 125 150
Thermistor Temperature (C)
FIGURE 14:
Analog Circuit Errors.
Digital Design
The PIC16F684 microcontroller (Appendix A.2.5 "Signal Analysis PICtail Daughter Board") handles several important tasks. It communicates with the PGA to set its gain and input channel, can provide averaging to reduce the noise and converts the result into the temperature at the thermistor using a piece-wise linear interpolation table. The microcontroller can have either a SPI port built in or the SPI interface can be implemented in software on the microcontroller [7].
2004 Microchip Technology Inc.
DS00897B-page 5
AN897
FLOWCHARTS
The second design's flowchart is shown in Figure 15. It is very similar to the first design program, with the exception that it has added a PGA hysteresis routine. The firmware is available in the 00897.zip file. The firmware was written in relocatable assembly code. The main.asm file controls the overall program flow. The PGA routines are in pga.inc and pga.asm. The thermistor routines are in Therm_PGA2.inc and Therm_PGA2.asm. Start Get Real Time Sample The Signal Analysis PC Program commands the PIC16F684 firmware to perform a real-time sample. The firmware reads the ADC value and passes it to the PGA hysteresis routine. Figure 16 shows the detail of the PGA hysteresis routine. The routine checks to see what PGA gain is set (the variable "PGAgain"). Based on PGAgain, the ADC value is tested for end-point (trip) values. If the ADC value is beyond the trip point value, PGAgain is set to the next higher or lower gain setting. Upon exiting the PGA hysteresis routine, the firmware checks if PGAgain was changed. If there was no change (Return 0), the program continues. If there was a change (Return 1), the firmware re-reads the ADC. Once the PGA gain and ADC value are known, both values are passed to the piece-wise linear interpolation routine. Based on the PGA gain setting, the correct look-up table is referenced. The PwLI routine converts the 10-bit ADC value into a 16-bit fixed decimal point degrees Celsius value. The fixed decimal point format reports degrees Celsius in tenths of a degree. Performing the piece-wise linear interpolation in tenths of a degree provides better resolution of degrees Celsius. Finally, the 16-bit degrees Celsius value is sent to the Signal Analysis PC Program for display on the real-time strip chart graph. In the final design, the designer can elect to receive reports in tenths of a degree or that they be rounded up into whole degrees.
Read ADC PGA Hysteresis
Was PGAgain Changed? No Perform PwLI Send C to Strip Chart End
Yes
FIGURE 15: Design.
Flowchart for Second
PGA Hysteresis IF PGAgain = 1 N IF PGAgain = 8 Y N N IF PGAadc > 960 N IF PGAgain = 32 N IF PGAadc > 960 N Set PGAgain = 1 IF PGAadc < 113 N IF PGAadc < 226
Y
Y
Set PGAgain = 8
Y
Set PGAgain = 32
Y
Y
Y Return 0
Set PGAgain = 8 Return 1
FIGURE 16:
Flowchart for Second Design's PGA Hysteresis Subroutine.
DS00897B-page 6
2004 Microchip Technology Inc.
AN897
PIECE-WISE LINEAR INTERPOLATION TABLE
Interpolation Error (C)
Each of the three gains uses a piece-wise linear interpolation table [9] to convert ADC codes to estimated temperature. Within each table, the ADC's codes were divided into 64 segments, with 16 codes per segment. The tables only include those ADC codes at the end points between segments. Table 3 shows the extreme valid table entries for each of the three tables.
0.04 0.03 0.02 0.01 0.00 -0.01 -0.02 -0.03 -0.04 -50
Design # 2
TABLE 3:
Gain (V/V) 1 8 32
INTERPOLATION TABLE END POINTS.
TTH (C) -43.5 51.2 49.2 94.9 92.6 150.9 RTH () 420k 3.44k 3.72k 787 845 179 VOUT (V) 4.688 0.547 4.688 1.094 4.688 1.016
-25
0
25
50
75
100
125
150
ADC Code (LSb) 960 112 960 224 960 208
Thermistor Temperature (C)
FIGURE 17: Piece-wise Linear Interpolation Error, Design # 2.
The digital roundoff error will be roughly proportional to the ADC temperature resolution curve's envelope (see Figure 13). If the roundoff error is much less than the ADC resolution, this error will have little impact. The total digital error includes both the piece-wise linear interpolation error and round-off error.
Values of TTH and RTH beyond the specified temperature range of the thermistor (-40C to +150C) are estimates only; they are not supported by actual data. The thermistor self-heating error correction has been included in Table 3. The table's entries go outside of -40C to +150C to ensure proper functioning of the piece-wise linear interpolation table when the reading overflows. In this algorithm (Appendix A.2.6 "Firmware for the Signal Analysis PICtail Daughter Board"), the table values outside the valid range take on the nearest valid value. This means that when G = 1 and ADC code > 960, the table returns a value of -43.5C. When G = 32 and ADC code < 208, the table returns a value of 150.9C. The other table entries beyond the end points in Table 3 (e.g., near gain-change points) are zero because the hysteresis algorithm will prevent them from being read. This approach has been used for readability.
DESIGN COMPARISON
Figure 18 shows the thermistor's specified accuracy. It contributes the same error to both designs.
2.0 1.8 1.6 1.4 1.2 1.0 0.8 0.6 0.4 0.2 0.0
Thermistor Error Magnitude (C)
BC Components(R) # 2322 640 55103 10 k @ +25C
-50
-25
0
25
50
75
100 125 150
Thermistor Temperature (C)
Digital Error Analysis
Figure 17 shows the estimated interpolation error for the interpolation table. Changing the PGA's gain takes full advantage of the ADC's resolution. The accuracy of this piece-wise linear interpolation table is 0.034C over the -40C to +150C temperature range. The improved ADC temperature resolution makes this design's piece-wise linear interpolation table behave much better than the first design's.
FIGURE 18:
Thermistor Accuracy.
Figure 19 compares the ADC temperature resolution between the first and second design. The second design is better because changing the PGA's gain helps improve the ADC temperature resolution.
2004 Microchip Technology Inc.
DS00897B-page 7
AN897
ADC Temperature Resolution (C/LSb)
0.0 -0.5 -1.0 -1.5 -2.0 -2.5 -50 -25 0 25 50 75 100 125 150
Thermistor Temperature (C)
Figure 22 compares the total errors (thermistor plus circuit plus piece-wise linear interpolation) of the first and second designs. The digital roundoff error has been excluded for simplicity.
2nd Design 1st Design
12 11 10 9 8 7 6 5 4 3 2 1 0 -50 -25 0
10-bit ADC DC Error 3.5 LSb
FIGURE 19: Resolution.
ADC Temperature
Total Design Error Magnitude (C)
1st Design 2nd Design
25
50
75
100
125
150
Figure 20 compares the analog circuit errors between the designs. The second design's error is better at high temperatures because the ADC's temperature resolution is better. It is also better at low temperatures because RA has been selected to linearize the temperature-to-voltage conversion there.
11 10 9 8 7 6 5 4 3 2 1 0 -50 -25 0
Thermistor Temperature (C)
FIGURE 22:
Total Error Comparison.
Other trade-offs between the two designs are summarized in Table 4.
TABLE 4:
Analog Circuit Error Magnitude (C)
TRADE-OFFS.
Criteria First Design Medium Low -- Low Second Design High High 0.3C Medium
Design # 1 Design # 2
Temperature Range Temperature Accuracy Discontinuity at gain changes Firmware Size
25
50
75
100
125
150
MEASURED RESULTS
Both designs were measured on the bench. The thermistor was emulated with the variable resistor Rvar on the board shown in Appendix A.1 "Thermistor PGA PICtail Daughter Board". The ADC outputs were converted to estimated thermistor temperatures using nominal resistor values. Figure 23 shows the first design's measured error, while Figure 24 shows the second design's measured error.
4 Measured Error (C)
Thermistor Temperature (C)
FIGURE 20: Comparison.
Analog Circuit Error
The digital piece-wise linear interpolation errors are compared in Figure 21. The second design has much better performance because the linear interpolation table segments cover smaller changes in temperature.
1.0 0.8 0.6 0.4 0.2 0.0 -0.2 -0.4 -0.6 -0.8 -1.0 -50 -25 0
Interpolation Error (C)
Design # 1 Design # 2
3 2 1 0 -1 -2 -3 -4
Design # 1 Thermistor Emulator, Rvar
25
50
75
100
125
150
-50
-25
0
25
50
75
100
125
150
Thermistor Temperature (C)
Thermistor Temperature (C)
FIGURE 21: Comparison.
Digital Interpolation Error
FIGURE 23: Design # 1.
Measured Errors,
DS00897B-page 8
2004 Microchip Technology Inc.
AN897
Other Gains
0.5 0.4 0.3 0.2 0.1 0.0 -0.1 -0.2 -0.3 -0.4 -0.5 Measured Error (C) Design # 2 Thermistor Emulator, Rvar
The second design can be done with other gains. Increasing the number of gains has the drawback of needing more piece-wise linear interpolation tables, increasing the firmware size. Adding a gain(s) between +1 and +8 increases the ADC resolution. The decrease in gain accuracy (from 0.1% at G = +1 to 1% at G +2) reduces the overall accuracy, especially at a gain of +2. The tradeoffs depend on the design specifics. Adding a gain between +8 and +32 improves both the accuracy and the ADC resolution at higher temperatures. The choice of +16 is a good one. Removing the gain of +32 may be attractive for designs that reach a reduced temperature range (e.g., +125C). Changing the gain of +32 to +16, instead of removing it, is one compromise. When the gains are related by a common multiplier, the hysteresis algorithm is simplified. When G = 1, 2, 4, 8, 16, and 32, the multiplier is 2. When G = 1, 4 and 16, the multiplier is 4. The gain increases all occur at one ADC code, while the gain decreases all occur at another ADC code. Thus, the hysteresis algorithm only has to compare the ADC code to two code values and change the gain based on the result.
G = +1 -50 -25 0 25 50
G = +8 75 100
G = +32 125 150
Thermistor Temperature (C)
FIGURE 24: Design # 2.
Measured Errors,
Note that it was necessary to add a resistor in series with Rvar at high temperatures in order to have 5C spacing between data points. Both Figure 23 and Figure 24 agree with the design results; the second design has much better performance. The 1% resistors in Rvar will give roughly the same error as the thermistor. The thermistor was then used to measure room temperature using Design # 2. The result was ADC code 281 with a gain of +1, which corresponds to 23.7C (74.7F).
More Input Channels
DESIGN ALTERNATIVES
The references in this application note include information on other design approaches. AN685 [3] covers more traditional application circuits using thermistors. AN867 [4] shows an alternative thermistor circuit using the PGA; it has greater flexibility, but increased design cost and complexity. The following sections discuss modifications to the designs in this application note.
When more than two inputs (including other temperature sensors) need to be multiplexed into the ADC, the 6-channel MCP6S26 and the 8-channel MCP6S28 PGAs provide additional channels. The thermistor input can be used to correct other sensors, such as humidity sensors.
Op Amp Buffer
The MCP6SX2 PGA, shown in Figure 3, can be replaced with a unity-gain buffer; Microchip's MCP6001 op amp would be a good choice. The advantages include simplicity and cost. The disadvantages are the inability to multiplex multiple input signals and the improvement in ADC temperature resolution due to changing the PGA's gain.
Increased Accuracy
In order to achieve greater accuracy, the analog components need to be more precise. 12-bit ADCs, (e.g., the MCP3201) will increase the resolution. A 0.1% tolerance resistor for RA will reduce the circuit error. Calibrating the thermistor [1, 2] will cancel most of its variation over process. It may be beneficial to also calibrate the circuit. This will increase firmware complexity and execution time on the microcontroller unless the corrections are included in the linear interpolation table(s). The piece-wise linear interpolation table may need more entries, especially for the first design. The calculations will require more precision, which results in slower processing time.
Remote Thermistor Issues
Thermistors that are located remotely from the PGA (e.g., not on the same PCB) may require design changes. Possible issues include: * * * * Shielding sensor pickup wires EMI filtering and protection Wiring resistance voltage drop Mismatch between thermistor ground and PCB ground
2004 Microchip Technology Inc.
DS00897B-page 9
AN897
SUMMARY
Two different circuit designs using the MCP6SX2 PGA and an accurate NTC thermistor have been shown. The two designs trade off simplicity, accuracy and temperature range. The first design is easier to implement, but has a smaller temperature range. It can be made more accurate, or cover a wider temperature range, with more expensive components and analog design effort. While the second design's firmware takes more space in firmware, the analog design is very reasonable. It takes advantage of the PGA's flexibility and digital control to reduce the analog errors and increase the temperature resolution. The MCP6SX2 PGA's input MUX and digitallycontrolled gain significantly increase the utility of these circuits. Multiple sensors and/or input signals can be processed with one PGA, reducing component count. It also makes it easier to perform temperature correction on other sensors. The marginal cost of the NTC thermistor circuits is reasonable in this case.
REFERENCES
[1] "2322 640 5... : NTC thermistors, accuracy line," Product Data Sheet, BC Components(R), September 27, 2001 (www.bccomponents.com). "Introduction to NTCs: NTC Thermistors," Data Sheet, BC Components, March 27, 2001 (www.bccomponents.com). AN685, "Thermistors in Single-Supply Temperature Sensing Circuits," Bonnie C. Baker; Microchip Technology Inc., DS00685, 1999. AN867, "Temperature Sensing with a Programmable Gain Amplifier," Bonnie C. Baker; Microchip Technology Inc., DS00867, 2003. MCP6S21/2/6/8 Data Sheet, "Single-Ended, Rail-to-Rail I/O, Low-Gain PGA," Microchip Technology Inc., DS21117, 2003. MCP6S91/2/3 Data Sheet, "Single-Ended, Rail-to-Rail I/O, Low-Gain PGA," Microchip Technology Inc., DS21908, 2004. AN248, "Interfacing MCP6S2X PGAs to PICmicro(R) Microcontroller," Ezana Haile; Microchip Technology Inc., DS00248, 2003. PIC16F684 Data Sheet, "14-Pin Flash-Based, 8-Bit MOS Microcontrollers with nanoWatt Technology," Microchip Technology Inc., DS41202, 2004. AN942, "Piecewise Linear Interpolation on PIC12/14/16 Series Microcontrollers," John Day and Steven Bible; Microchip Technology Inc., 2004. "PICkitTM 1 Flash Starter Kit User's Guide," Microchip Technology Inc., DS40051, 2004. "Signal Analysis PICtailTM Daughter Board User's Guide," Microchip Technology Inc., DS51476, 2004. "Thermistor PGA PICtailTM Daughter Board User's Guide," Microchip Technology Inc., DS51517, 2004.
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10] [11]
[12]
DS00897B-page 10
2004 Microchip Technology Inc.
AN897
APPENDIX A:
A.1
SET-UP OVERVIEW
A.2
Associated Tools
Thermistor PGA PICtail Daughter Board
The Thermistor PGA PICtail Daughter Board contains the analog circuitry represented in Figure A-1. The thermistor converts its temperature to a resistance. The voltage divider then converts that resistance to voltage and sends it to the CH0 input of the PGA. The PGA gains and buffers this voltage and sends it off-board. Board power is applied at the +5V and GND inputs. The SPITM bus makes it possible to control the PGA; its gain and input channel can be set as desired from the software. Thermistor PGA PICtailTM Daughter Board Temperature Thermistor +5V Test Point GND Test Point CH0 Input Test Point CH1 Input Test Point PGA MCP6S22 Voltage Divider +5V GND
Figure A-2 shows the block diagram of the hardware and software tools that the Thermistor PGA PICtailTM Daughter Board is designed to work with. More information on these tools can be found in the "References" section. Hardware PC USB PICkitTM 1 Flash Starter Kit 14 Signal Analysis PICtail Daughter Board 14 Thermistor PGA PICtailTM Daughter Board PICA2Dlab.hex Firmware PICkit 1 Firmware Software PICkit 1 Signal Analysis PC Program
4 SPITM Bus VOUT
FIGURE A-2: Diagram.
Measurement Setup Block
FIGURE A-1: Thermistor PGA PICtailTM Daughter Board Block Diagram.
The test points make it easier to test key points in the circuit, change the input signals and to use this board as a stand-alone board. * GND Test Point - Connected to the ground plane and is a convenient ground point for any lab equipment * +5V Test Point - Allows measurement of the positive supply voltage and provides a means to power this board with a laboratory power supply * CH0 Test Point - The place to measure the voltage divider's output (also the PGA's CH0 input) * CH1 Test Point - Makes it possible to send any desired signal to the PGA More detail on setting up this demonstration board can be found in the "Thermistor PGA PICtailTM Daughter Board User's Guide" [12].
2004 Microchip Technology Inc.
DS00897B-page 11
AN897
An exploded view of how the different boards connect is shown in Figure A-3.
Thermistor PGA PICtailTM Daughter Board
Signal Analysis PICtailTM Daughter Board
USB Cable Expansion Header (J3)
Remove PICmicro(R) MCU from Evaluation Socket PICkitTM 1 Flash Starter Kit PIC16C745 Firmware Version 2.0.2 or later
FIGURE A-3: A.2.1
Board Connections. A.2.4 PICkit 1 FIRMWARE
PC PLATFORM
The Personal Computer (PC) shown in Figure A-2 needs to run on Windows(R) 98 SE or later. It provides a convenient interface for the user, communicates with the other boards, and provides power through the USB connection.
This software resides on the PICkit 1 Flash Starter Kit's PIC16C745 microcontroller. Use version 2.0.2 or later.
A.2.5
SIGNAL ANALYSIS PICtail DAUGHTER BOARD
A.2.2
PICkitTM 1 SIGNAL ANALYSIS PC PROGRAM
The PICkitTM 1 Signal Analysis PC Program programs the PIC16F684 PICmicro(R) microcontroller on the Signal Analysis PICtail Daughter Board through the USB port on the PICkit 1 Flash Starter Kit. It also imports data through the same connection and displays the data in Strip Chart, histogram, FFT plot and oscilloscope plot formats. Data can be output in CSV format for importing into a spreadsheet program.
This board is Microchip Development Tool AC164120. It connects to the PICkit 1 Flash Starter Kit, which it uses for both power and as a communications link to the PC. The on-board PIC16F684 has a 10-bit ADC that converts the Thermistor PGA PICtail Daughter Board's output voltage. The results are temporarily stored on the board's 25LC640 serial EEPROM chips. The +5V single-supply voltage from the PICkit 1 Flash Starter Kit board is bypassed with a bulk 1 F capacitor and local 0.1 F capacitors for each IC.
A.2.3
PICkit 1 FLASH STARTER KIT
The PICkit 1 Flash Starter Kit (DV164101) programs PICmicro microcontrollers. It uses the PIC16C745's USB port to communicate with the PICkit 1 Signal Analysis PC Program. It connects to the Signal Analysis PICtail Daughter Board via a header (see Figure A-3). This board provides a single +5V supply voltage for the daughter boards. It can drive up to 5 F on the supply; a larger capacitance may interfere with program timing.
DS00897B-page 12
2004 Microchip Technology Inc.
AN897
A.2.6 FIRMWARE FOR THE SIGNAL ANALYSIS PICtail DAUGHTER BOARD
Therm_PGA2.hex implements the second design. It supports the PICkit 1 Signal Analysis PC Program, but with reduced functionality; its output can be viewed on the strip chart only. The results need to be manually converted to temperatures (codes 0 to 1023 convert to 0.0C to 102.3C).
PICA2Dlab.hex is the standard file that supports the PICkitTM 1 Signal Analysis PC Program. The PGA and 10-bit ADC configuration are selected in the Signal Analysis PC Program and written to the PIC16F684. The PIC16F684 then sends the command(s) over the SPI bus to the PGA. Therm_PGA1.hex implements the first design. It supports the PICkit 1 Signal Analysis PC Program, but with reduced functionality; its output can be viewed on the strip chart only. The results need to be manually converted to temperatures (codes 0 to 1023 convert to 0.0C to 102.3C). Thermistor PGA PICtailTM Daughter Board Temperature Thermistor +5V Test Point GND Test Point CH0 Input Test Point CH1 Input Test Point PGA MCP6S22 Voltage Divider +5V GND
A.2.7
INTERFACE DETAILS
A more detailed look at how the Thermistor PGA PICtail Daughter Board interfaces with the other boards is shown in Figure A-4.
Signal Analysis PICtailTM Daughter Board
PICkitTM 1 Flash Starter Kit
Serial EEPROM 4 SPITM Bus
+5V GND
4 SPI Bus VOUT PIC16F684 ADC
2
PIC16F745
USB
to PC
FIGURE A-4:
Detailed Interface Diagram.
2004 Microchip Technology Inc.
DS00897B-page 13
AN897
APPENDIX B: THERMISTOR MODEL
The nominal response of the 2322 640 55103 thermistor [1] is shown in Table B-1. The data in Table B-1 was fit to the following sets of equations. These equations make it possible to accurately interpolate values between the table entries, thus making the designs easier to evaluate.
TABLE B-1:
NOMINAL THERMISTOR RESPONSE.
Thermistor Resistance () 332.1 k 240.0 k 175.2 k 129.3 k 96.36 k 72.50 k 55.05 k 42.16 k 32.56 k 25.34 k 19.87 k 15.70 k 12.49 k 10.00 k 8.059 k 6.535 k 5.330 k 4.372 k 3.606 k 2.989 k 2.490 k 2.084 k 1.753 k 1.481 k 1.256 k 1.070 k 915.4 786.0 677.3 585.8 508.3 442.6 386.6 338.7 297.7 262.4 231.9 205.5 182.6
EQUATION B-1:
Resistance-to-Temperature Equations: X = ln(RTH / 1) z = XSC (X - XCTR) T0 - T25 TTH 1 + z(A1 + z(A2 + z(A3))) where: 182.6 RTH 332.1 k XSC = -0.266457 XCTR = 8.960245 T0 = 303.960C A1 = -0.291639 A2 = 0.010993 A3 = -0.001042 T25 = 273.150C
Thermistor Temperature (C) -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150
EQUATION B-2:
Temperature-to-Resistance Equations: Y= 1 TTH + T25
z = YSC (Y - YCTR) X B0 + z(B1 + z(B2 + z(B3))) RTH = (1 ) eX where: -40C TTH +150C T25 = 273.150C YSC = -1038.499C YCTR = 0.003326156 C-1 B0 = 9.101806 B1 = -3.756408 B2 = -0.141435 B3 = 0.003396 The piece-wise linear interpolation tables also need values outside of the valid range of Table B-1. These values are only used for convenience in setting up the interpolation tables and firmware routine; they are not based on actual data. While the above equations are not valid outside of the given ranges, they are good enough to support the interpolation algorithm. Both sets of equations are based on a min-max polynomial fit on the normalized variable z. It is more difficult to achieve an accurate fit to the data using the variables X and Y.
DS00897B-page 14
2004 Microchip Technology Inc.
Note the following details of the code protection feature on Microchip devices: * * Microchip products meet the specification contained in their particular Microchip Data Sheet. Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip's Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. Microchip is willing to work with the customer who is concerned about the integrity of their code. Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as "unbreakable."
*
* *
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip's code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip's products as critical components in life support systems is not authorized except with express written approval by Microchip. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.
Trademarks The Microchip name and logo, the Microchip logo, Accuron, dsPIC, KEELOQ, microID, MPLAB, PIC, PICmicro, PICSTART, PRO MATE, PowerSmart, rfPIC, and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. AmpLab, FilterLab, MXDEV, MXLAB, PICMASTER, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, dsPICDEM, dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, Migratable Memory, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo, PowerMate, PowerTool, rfLAB, rfPICDEM, Select Mode, Smart Serial, SmartTel and Total Endurance are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. (c) 2004, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper.
Microchip received ISO/TS-16949:2002 quality system certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona and Mountain View, California in October 2003. The Company's quality system processes and procedures are for its PICmicro(R) 8-bit MCUs, KEELOQ(R) code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip's quality system for the design and manufacture of development systems is ISO 9001:2000 certified.
DS00897B-page 15
2004 Microchip Technology Inc.
WORLDWIDE SALES AND SERVICE
AMERICAS
Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http:\\support.microchip.com Web Address: www.microchip.com Atlanta Alpharetta, GA Tel: 770-640-0034 Fax: 770-640-0307 Boston Westford, MA Tel: 978-692-3848 Fax: 978-692-3821 Chicago Itasca, IL Tel: 630-285-0071 Fax: 630-285-0075 Dallas Addison, TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills, MI Tel: 248-538-2250 Fax: 248-538-2260 Kokomo Kokomo, IN Tel: 765-864-8360 Fax: 765-864-8387 Los Angeles Mission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608 San Jose Mountain View, CA Tel: 650-215-1444 Fax: 650-961-0286 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699 Fax: 905-673-6509
ASIA/PACIFIC
Australia - Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China - Beijing Tel: 86-10-8528-2100 Fax: 86-10-8528-2104 China - Chengdu Tel: 86-28-8676-6200 Fax: 86-28-8676-6599 China - Fuzhou Tel: 86-591-750-3506 Fax: 86-591-750-3521 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 China - Shunde Tel: 86-757-2839-5507 Fax: 86-757-2839-5571 China - Qingdao Tel: 86-532-502-7355 Fax: 86-532-502-7205
ASIA/PACIFIC
India - Bangalore Tel: 91-80-2229-0061 Fax: 91-80-2229-0062 India - New Delhi Tel: 91-11-5160-8632 Fax: 91-11-5160-8632 Japan - Kanagawa Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 Taiwan - Hsinchu Tel: 886-3-572-9526 Fax: 886-3-572-6459
EUROPE
Austria - Weis Tel: 43-7242-2244-399 Fax: 43-7242-2244-393 Denmark - Ballerup Tel: 45-4420-9895 Fax: 45-4420-9910 France - Massy Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Germany - Ismaning Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Netherlands - Drunen Tel: 31-416-690399 Fax: 31-416-690340 England - Berkshire Tel: 44-118-921-5869 Fax: 44-118-921-5820
09/27/04
DS00897B-page 16
2004 Microchip Technology Inc.


▲Up To Search▲   

 
Price & Availability of AN897

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X